﻿using DataTurnClient.Interface;
using DataTurnClient.ViewModel;
using Splat;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Windows.UI.Xaml.Controls;
using DataTurnClient.Actions;

namespace DataTurnClient.Server
{
    public class AntdMessage : IAntdMessage
    {
        public AntdUI.Tooltip.Config TooltipConfig(System.Windows.Forms.Control control,string text)
        {
            AntdUI.Tooltip.Config config = new AntdUI.Tooltip.Config(control, text)
            {
                ArrowAlign = AntdUI.TAlign.Bottom,
                Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)))
            };
            return config;
        }

        public AntdUI.Drawer.Config DrawerConfig(Form form,System.Windows.Forms.Control control)
        {
            var viewModel = Locator.Current.GetService<MainTurnViewModel>();
            AntdUI.Drawer.Config config = new AntdUI.Drawer.Config(form, control)
            {
                Align = AntdUI.TAlignMini.Right,
                Mask = true
            };
            return config;
        }

        public AntdUI.Message.Config MessageConfig(Form form, string text, AntdUI.TType type)
        {
            AntdUI.Message.Config config = new AntdUI.Message.Config(form, text, type);
            return config;
        }

        public AntdUI.ContextMenuStrip.Config ConTextMenuConfig(System.Windows.Forms.Control control,Action<AntdUI.ContextMenuStripItem> call)
        {
            var menuList = new List<AntdUI.ContextMenuStripItem>();
            var menulist = new AntdUI.IContextMenuStripItem[]
            {
                new AntdUI.ContextMenuStripItem("查看")
                {
                    IconSvg = SvgImag.svg_select()
                },
                new AntdUI.ContextMenuStripItem("操作")
                {
                    IconSvg = SvgImag.svg_operare(),
                    Sub = new AntdUI.IContextMenuStripItem[]
                    {
                        new AntdUI.ContextMenuStripItem("增加")
                        {
                            IconSvg = SvgImag.svg_add()
                        },
                        new AntdUI.ContextMenuStripItem("编辑")
                        {
                            IconSvg = SvgImag.svg_edit()
                        },
                        new AntdUI.ContextMenuStripItem("删除")
                        {
                            IconSvg = SvgImag.svg_delete()
                        },
                        new AntdUI.ContextMenuStripItem("更改状态")
                        {
                            IconSvg = SvgImag.svg_change()
                        },
                    }
                },
                new AntdUI.ContextMenuStripItemDivider(),
                new AntdUI.ContextMenuStripItem("刷新")
                {
                    IconSvg = SvgImag.svg_refresh()
                },
                new AntdUI.ContextMenuStripItemDivider(),
                new AntdUI.ContextMenuStripItem("执行所有任务")
                {
                    IconSvg = SvgImag.svg_runall()
                },
                new AntdUI.ContextMenuStripItem("执行")
                {
                    IconSvg = SvgImag.svg_run()
                },
            };
            menuList.Add(new AntdUI.ContextMenuStripItem("查看"));
            menuList.Add(new AntdUI.ContextMenuStripItem("增加"));
            menuList.Add(new AntdUI.ContextMenuStripItem("编辑"));
            menuList.Add(new AntdUI.ContextMenuStripItem("删除"));
            menuList.Add(new AntdUI.ContextMenuStripItem("更改状态"));
            menuList.Add(new AntdUI.ContextMenuStripItem("执行"));
            menuList.Add(new AntdUI.ContextMenuStripItem("刷新"));
            menuList.Add(new AntdUI.ContextMenuStripItem("执行所有任务"));
            Globals.ContextMenuItems = menuList;
            AntdUI.ContextMenuStrip.Config config = new AntdUI.ContextMenuStrip.Config(control, call, menulist);
            config.UFocus = true;
            return config;
        }
    }
}
